﻿using Core.DataAccess.Model.Project.Information;
using Core.Framework.Model.Common;
using Core.IBusiness.IInformation.Model;
using System;
using System.Collections.Generic;
using System.Text;

namespace Core.IBusiness.IInformation
{
    /// <summary>
    /// 信息操作接口
    /// </summary>
    public interface IInformation : IInformationType
    {
        /// <summary>
        /// 信息操作
        /// ---------
        /// 写入发生
        /// - 初始化[Fabulous]  [Follow]  [ReadingCount]  [Share]  
        /// - 初始化按需[IsAdvertisement]  [Topic]  [AttrUser] 
        /// </summary>
        /// <param name="model">数据实体</param>
        /// <param name="sqlExecType">操作类型</param>
        /// <returns></returns>
        MethodResult<int> InformationExec(InformationList model, SqlExecType sqlExecType);


        /// <summary>
        /// 信息扩展属性操作
        /// </summary>
        /// <param name="model">数据模型</param>
        /// <param name="sqlExecType">操作类型</param>
        /// <returns></returns>
        MethodResult<int> InformationAttributeExec(InformationAttribute model, SqlExecType sqlExecType);




        /// <summary>
        /// 获取单挑信息的所有信息【或者指定属性集合】
        /// 增加阅读量
        /// </summary>
        /// <param name="model"></param>
        /// <param name="isComment"></param>
        /// <param name="attributes"></param>
        /// <returns></returns>
        MethodResult<InformationList> GetInformationItem(InformationList model, bool isComment, List<InformationAttributeEnum> attributes = null);

        /// <summary>
        /// 获取信息
        /// 支持搜索
        /// 支持指定分类
        /// </summary>
        /// <param name="Type">分类【可选参数】</param>
        /// <param name="projectToken">项目token</param>
        /// <param name="pagination">分页参数</param>
        /// <param name="search">搜索内容</param>
        /// <returns></returns>
        MethodResult<List<InformationList>> GetInformationSearch(int Type, string projectToken, Pagination pagination, string search = null);

        /// <summary>
        /// 获取信息
        /// 支持分类
        /// 支持属性
        /// 支持搜索
        /// </summary>
        /// <param name="Type">分类【可选参数】</param>
        /// <param name="projectToken">项目token</param>
        /// <param name="pagination">分页参数</param>
        /// <param name="search">搜索内容</param>
        /// <param name="attributes">属性集合</param>
        /// <param name="isGetCommtent">是否查询评论</param>
        /// <returns></returns>
        MethodResult<List<InformationList>> GetInformationAttributes(int Type, string projectToken, List<InformationAttributeEnum> attributes, Pagination pagination, string search = null, bool isGetCommtent = false);


        /// <summary>
        /// 根据属性获取信息
        /// </summary>
        /// <param name="Type">分类</param>
        /// <param name="projectToken">项目token</param>
        /// <param name="search">搜索内容</param>
        /// <param name="attributes">属性集合</param>
        /// <param name="isGetCommtent">是否查询评论</param>
        /// <param name="pagination">分页参数</param>
        /// <returns></returns>
        MethodResult<List<InformationList>> GetInformationByAttributes( string projectToken, List<InformationAttributeEnum> attributes, Pagination pagination, int Type = 0, string search = null, bool isGetCommtent = false);



        /// <summary>
        /// 获取用户发布的文章信息
        /// </summary>
        /// <param name="userKey">用户ID</param>
        /// <param name="projectToken">项目Token</param>
        /// <param name="pagination">分页参数</param>
        /// <param name="search">搜索内容</param>
        /// <param name="type">分类信息</param>
        /// <param name="attributes">获取所有属性</param>
        /// <returns></returns>
        MethodResult<List<InformationList>> GetInformationUser(int userKey, string projectToken, Pagination pagination, List<InformationAttributeEnum> attributes, int type, string search = null);


        /// <summary>
        /// 根据属性获取用户发布的文章信息
        /// </summary>
        /// <param name="userKey">用户ID</param>
        /// <param name="projectToken">项目Token</param>
        /// <param name="pagination">分页参数</param>
        /// <param name="search">搜索内容</param>
        /// <param name="isGetCommtent">是否获取评论</param>
        /// <param name="attributes">获取所有属性</param>
        /// <returns></returns>
        MethodResult<List<InformationList>> GetInformationUserByAttributes(int userKey, string projectToken, Pagination pagination, List<InformationAttributeEnum> attributes, bool isGetCommtent, string search = null);






        /// <summary>
        /// 点赞
        /// </summary>
        /// <param name="infoKey">信息关键字</param>
        /// <param name="clientInfo">用户信息</param>
        /// <returns></returns>
        MethodResult<int> InformationStar(int infoKey, ApiClientInfo clientInfo);

        /// <summary>
        /// 取消点赞
        /// </summary>
        /// <param name="infoKey">信息关键字</param>
        /// <param name="userKey">用户关键字</param>
        /// <param name="clientToken">客户端Token</param>
        /// <returns></returns>
        MethodResult<int> InformationUnStar(int infoKey, int userKey, string clientToken);



        /// <summary>
        /// 关注
        /// </summary>
        /// <param name="infoKey">信息关键字</param>
        /// <param name="userKey">用户关键字</param>
        /// <param name="clientToken">客户端Token</param>
        /// <returns></returns>
        MethodResult<int> InformationWatch(int infoKey, ApiClientInfo clientInfo);

        /// <summary>
        /// 取消关注
        /// </summary>
        /// <param name="infoKey">信息关键字</param>
        /// <param name="userKey">用户关键字</param>
        /// <param name="clientToken">客户端Token</param>
        /// <returns></returns>
        MethodResult<int> InformationUnWatch(int infoKey, int userKey, string clientToken);


        /// <summary>
        /// 新增阅读量
        /// </summary>
        /// <param name="infoKey">信息关键字</param>
        /// <param name="userKey">用户关键字</param>
        /// <param name="count">新增数量</param>
        /// <returns></returns>
        MethodResult<int> InformationRead(int infoKey, int userKey, int count = 1);



        /// <summary>
        /// 获取用户浏览历史信息
        /// </summary>
        /// <param name="userKey">用户ID</param>
        /// <param name="projectToken">项目Token</param>
        /// <param name="type">搜索内容</param>
        /// <param name="pagination">获取所有属性</param>
        /// <returns></returns>
        MethodResult<List<InformationHistory>> GetInformationHistoryUser(int userKey,int type, string projectToken, Pagination pagination);



    }
}
